#pragma once
/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * DNS Next Domain Record Structure
 *      Represents a DNS Next Domain (NXT) record.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
#include "stdafx.h"
using namespace System;
using namespace System::Net;

namespace Adaptive
{
	namespace Network
	{
		namespace Dns
		{
			/// <summary>
			/// Represents a DNS Next Domain (NXT) record.
			/// </summary>
			public value struct DnsNextRecord
			{
			internal:
				/// <summary>
				/// Initializes a new instance of the class from the unmanaged record.
				/// </summary>
				/// <param name="record"> A pointer to a DNS_RECORD structure whose contents are to be copied.</param>
				DnsNextRecord(DNS_RECORD* record)
				{
					short count = 0;

					if (record == NULL)
					{
						NextName = String::Empty;
						NumberOfTypes = 0;
						TypesList = nullptr;
					}
					else
					{
						NextName = gcnew String ( record->Data.NXT.pNameNext );
						NumberOfTypes =  record->Data.NXT.wNumTypes;
						TypesList = gcnew array<short>(NumberOfTypes);
						for(count = 0; count < NumberOfTypes; count++)
							TypesList[count] = (short)record->Data.NXT.wTypes[count];
					}
				}
				private:
				/// <summary>
				/// Static constructor.
				/// </summary>
				static DnsNextRecord()
				{
				}
			public:

				/// <summary>
				/// A string representing the name of the next domain.
				/// </summary>
				/// <value>
				/// A domain name value or an empty string.
				/// </value>
				String^			NextName;
				/// <summary>
				/// Number of elements in the TypesList array.
				/// </summary>
				/// <value>
				/// The number of items in the array.
				/// </value>
				short			NumberOfTypes;
				/// <summary>
				/// Array of resource record type mnemonics for the owner name of the next resource record.
				/// </summary>
				/// <value>
				/// An array of short integer values, or <b>null</b>.
				/// </value>
				array<short>^	TypesList;
			};
		}
	}
}